﻿using EmailClientWPF.Data;
using EmailClientWPF.Models;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EmailClientWPF.ViewModels
{
    public class SentViewModel : ViewModelBase, IPageViewModel
    {
        private ObservableCollection<FolderResponseMessage> messagesList;

        //public ObservableCollection<FolderResponseMessage> MessagesList { get; set; }

        public IEnumerable<FolderResponseMessage> MessagesList
        {
            get
            {
                if (this.messagesList == null)
                {
                   // this.TodoLists = DataPersister.GetSentMessages(); todo make Method
                }
                return this.messagesList;
            }
            set
            {
                if (this.messagesList == null)
                {
                    this.messagesList = new ObservableCollection<FolderResponseMessage>();
                }
                this.messagesList.Clear();
                foreach (var item in value)
                {
                    this.messagesList.Add(item);
                }
            }
        }

        public SentViewModel() 
        {
            this.MessagesList = new ObservableCollection<FolderResponseMessage>();
        }

        public string Name
        {
            get
            {
                return "Sent";
            }
        }

        internal void ViewChanged(object sender, Helpers.ViewChangedArgs e)
        {
            throw new NotImplementedException();
        }
    }
}
